{template 'common/header'}
<ul class="nav nav-tabs">
	<li {if $op == 'list'}class="active"{/if}>
		<a href="{php echo $this->createWebUrl('search', array('op' => 'list'))}">查询管理</a>
	</li>
	<li {if $op == 'add'}class="active"{/if}>
		<a href="{php echo $this->createWebUrl('search', array('op' => 'add'))}">查询添加</a>
	</li>
</ul>
<div class="main">
<table class="table table-hover">
	<thead class="navbar-inner">
		<tr>
			<th style="width:10%">
				名称 <i></i>
			</th>
			<th style="width:30%">
				第三方网址
				<i></i>
			</th>
			<th style="width:10%">
				状态(点击可修改)
				<i></i>
			</th>
			<th class="row-hover" style="min-width:370px;">操作</th>
			<th class="row-hover span1" style="text-align:right;width:100px;"></th>
		</tr>
	</thead>
	<tbody id="status-items">
		{loop $list $item}
		<tr>
			<td>{$item['sname']}</td>
			<td>{$item['surl']}</td>
			<td>
				<label data='{$item['status']}' class='label label-default {if $item['status']==1}label-info{/if}' onclick="setProperty(this,{$item['id']},'status')">{if $item['status'] == 1}开启{else}关闭{/if}</label>
			</td>
			<td>
				<a href="{php echo $this->createWebUrl('search',array('op' => 'add','id' => $item['id']))}" title="编辑" class="btn btn-default btn-sm" ><i class="fa fa-edit" data-toggle="tooltip" data-placement="top"></i>编辑</a> 
                        
                 <a onclick="return confirm('此操作不可恢复，确认吗？'); return false;" href="{php echo $this->createWebUrl('search',array('op' => 'delete','id' => $item['id']))}" title="" data-toggle="tooltip" data-placement="top" class="btn btn-default btn-sm" data-original-title="删除"><i class="fa fa-times"></i>删除</a>
			</td>
		</tr>
		{/loop}
		{$pager}
	</tbody>
</table>
</div>
<script type="text/javascript">
	function setProperty(obj,id,type){
		$(obj).html($(obj).html() + "...");
		$.post("{php echo $this->createWebUrl('search',array('op' => 'set'))}"
			,{id:id,type:type, data: obj.getAttribute("data")}
			,function(d){
				$(obj).html($(obj).html().replace("...",""));
				if(type=='status'){
				 $(obj).html( d.data=='1'?'开启':'关闭');
				}
				$(obj).attr("data",d.data);
				if(d.result==1){
					$(obj).toggleClass("label-info");
				}
			}
			,"json"
		);
	}
</script>


{template 'common/footer'}